####
####
#### Project: Conditional Congressional Communication -- Analysis
#### Author: Rachel Blum, Lindsey Cormack, and Kelsey Shoub
#### Replication file created on Feb. 7, 2022
####
####

# As the raw text of the individual posts cannot be shared in their raw form, this R script begins with the data file of counts of use and covariates.

################## 1. Set-up ##################

# Packages.
library(ggplot2)
library(cowplot)
library(MASS)
library(readxl)
library(xtable)
library(dplyr)
library(texreg)

# Function 
summary.function = function(variables = NULL, names = NULL){
  
  output = data.frame("Minimum"=rep(NA,dim(variables)[2]),
                      "Median"=rep(NA,dim(variables)[2]),
                      "Mean"=rep(NA,dim(variables)[2]),
                      "Maximum"=rep(NA,dim(variables)[2]),
                      "Standard.Deviation"=rep(NA,dim(variables)[2]),
                      "Missing"=rep(NA,dim(variables)[2]))
  
  output$Minimum = apply(variables,2,function(x){min(x,na.rm=T)})
  output$Median = apply(variables,2,function(x){median(x,na.rm=T)})
  output$Mean = apply(variables,2,function(x){mean(x,na.rm=T)})
  output$Maximum = apply(variables,2,function(x){max(x,na.rm=T)})
  output$Standard.Deviation = apply(variables,2,function(x){sd(x,na.rm=T)})
  output$Missing = apply(variables,2,function(x){sum(is.na(x))})
  
  if(!is.null(names)){rownames(output) = names}
  
  return(output)
}

# Setting the working directory.
setwd("~/Desktop/MoC_PublicCommunication/MeasuringIdeology")

# Loading in the data.
load("Data/House_MediaDistrictInfo2.RData")

partial = read_excel("Data/partial_service_members114_thru_116.xlsx")
colnames(partial)

partial$months_served = partial$months_served_first_year + partial$months_served_second_year
partial$months_served_fb = ifelse(partial$congress_partial==115,
                                  partial$months_served_first_year,
                                  partial$months_served)

partial = partial %>% select(bioguide_id,congress_partial,months_served,months_served_fb)

colnames(partial) = c("bioguide_id","congress","months_served","months_served_fb")

house.wdist = merge(house.wdist,partial,by=c("bioguide_id","congress"),all.x = T)

house.wdist$months_served = ifelse(is.na(house.wdist$months_served),24,house.wdist$months_served)
house.wdist$months_served_fb = ifelse(is.na(house.wdist$months_served_fb)&
                                        house.wdist$congress!=115,24,
                                      ifelse(is.na(house.wdist$months_served_fb)&
                                               house.wdist$congress==115,12,house.wdist$months_served_fb))

summary(house.wdist[,190:191])

###
### Cleaning up the data set. 
###

house.wdist$pct_nonwht = house.wdist$race_wht_non/house.wdist$race_tot
house.wdist$pct_latinx = house.wdist$race_hsp/house.wdist$race_tot
house.wdist$pct_black = house.wdist$race_blk_non/house.wdist$race_tot
house.wdist$pct_white = house.wdist$race_wht_non/house.wdist$race_tot
house.wdist$pct_hs = house.wdist$educ_hs/house.wdist$educ_pop
house.wdist$pct_mtHS = 1-((house.wdist$educ_hs+house.wdist$educ_lesshs)/house.wdist$educ_pop)
house.wdist$pct_inpoverty = house.wdist$poverty_incomebelow/house.wdist$poverty_total

house.wdist$tweets.yr = round((house.wdist$tweets.count/house.wdist$months_served)*12,digits=0)
house.wdist$fb.yr = ifelse(house.wdist$congress==116, 
                           round((house.wdist$fb.posts.fb/house.wdist$months_served_fb)*12,digits=0),
                           round((house.wdist$fb.posts.pew/house.wdist$months_served_fb)*12,digits=0))
house.wdist$pr.yr = round((house.wdist$pr.counts/house.wdist$months_served)*12,digits=0)
house.wdist$enews.yr = round((house.wdist$enews.count/house.wdist$months_served)*12,digits=0)

house.wdist$tweets.scaled = scale(house.wdist$tweets.yr)
house.wdist$fb.scaled = scale(house.wdist$fb.yr)
house.wdist$pr.scaled = scale(house.wdist$pr.yr)
house.wdist$enews.scaled = scale(house.wdist$enews.yr)

house.wdist$pres_inparty = ifelse(house.wdist$dem==0&house.wdist$congress=="115",1,
                                  ifelse(house.wdist$dem==1&house.wdist$congress=="114",1,0))

house.wdist$leadership = ifelse(house.wdist$maj_leader==1|house.wdist$min_leader==1,1,0)
house.wdist$any_chair = ifelse(house.wdist$chair==1|house.wdist$subchr==1,1,0)

table(house.wdist$majority)

house.wdist$income_median_tens = house.wdist$income_median/100000

house.wdist$voteprop = house.wdist$votepct/100
house.wdist$voteprop2 = house.wdist$voteprop^2

house.wdist$income_gini_old = house.wdist$income_gini
house.wdist$income_gini = (min(house.wdist$income_gini,na.rm=T) + house.wdist$income_gini)/max(min(house.wdist$income_gini,na.rm=T) + house.wdist$income_gini,na.rm=T)

house.wdist$seniority = house.wdist$seniority-1
house.wdist$freshman = ifelse(house.wdist$seniority==0,1,0)

################## 2. Table 1 ##################

Table1 = summary.function(variables = house.wdist[,c("pr.yr","enews.yr",
                                                           "tweets.yr","fb.yr")],
                                names = c("Press Releases","E-Newsletters",
                                          "Tweets","Facebook Posts"))

xtable(Table1, type = "latex")

print(xtable(Table1, type = "latex"), file = "Table2.tex")

################## 3. Regressions + Figure 1 ##################

###
### Regressions using standardized DVs. Avg counts per year.
###

house.wdist$black_cat = ifelse(house.wdist$pct_black>0.5,1,0)
house.wdist$latino_cat = ifelse(house.wdist$pct_latinx>0.5,1,0)

lm.tweets = lm(tweets.scaled ~ dem+majority+pres_inparty+leadership+
                 any_chair+meddist + 
                 state_leg_prof+voteprop+ 
                 freshman +seniority+
                 female + afam + latino+ 
                 latino_cat+black_cat+
                 pct_mtHS+income_median_tens+
                 log(density_pop),
               data = house.wdist)
lm.fb = lm(fb.scaled ~  dem+majority+pres_inparty+leadership+
             any_chair+meddist + 
             state_leg_prof+voteprop+ 
             freshman +seniority+
             female + afam + latino+ 
             latino_cat+black_cat+
             pct_mtHS+income_median_tens+
             log(density_pop),
           data = house.wdist)
lm.enews = lm(enews.scaled ~  dem+majority+pres_inparty+leadership+
                any_chair+meddist + 
                state_leg_prof+voteprop+ 
                freshman +seniority+
                female + afam + latino+ 
                latino_cat+black_cat+
                pct_mtHS+income_median_tens+
                log(density_pop),
              data = house.wdist)
lm.pr = lm(pr.scaled ~  dem+majority+pres_inparty+leadership+
             any_chair+meddist + 
             state_leg_prof+voteprop+ 
             freshman +seniority+
             female + afam + latino+ 
             latino_cat+black_cat+
             pct_mtHS+income_median_tens+
             log(density_pop),
           data = house.wdist)

# Coefs. 
model.coefs = rbind(data.frame("Model"="(1) Press Releases",
                               "Coefficients"=c("Intercept","Democrat","Majority Party",
                                                "President of Same Party","Leadership",
                                                "Chair of Committee \nor Subcommittee",
                                                "Distance from Median \n(DW-Nominate)",
                                                "State Legislature \nProfessionalism",
                                                "Vote Prop., Last Election",
                                                "Freshman",
                                                "Seniority","Female","Black","Latino",
                                                "Majority Latinx","Majority Black",
                                                "Pct. More Than HS","Median Income",
                                                "log(Population Density)"),
                               "VarNames" = rownames(summary(lm.pr)$coefficients),
                               round(summary(lm.pr)$coefficients,digits=6)),
                    data.frame("Model"="(2) E-Newsletters",
                               "Coefficients"=c("Intercept","Democrat","Majority Party",
                                                "President of Same Party","Leadership",
                                                "Chair of Committee or Subcommittee",
                                                "Distance from Median (DW-Nominate)",
                                                "State Legislature Professionalism",
                                                "Vote Prop., Last Election",
                                                "Freshman",
                                                "Seniority","Female","Black","Latino",
                                                "Majority Latinx","Majority Black",
                                                "Pct. More Than HS","Median Income",
                                                "log(Population Density)"),
                               "VarNames" = rownames(summary(lm.enews)$coefficients),
                               round(summary(lm.enews)$coefficients,digits=6)),
                    data.frame("Model"="(3) Tweets",
                               "Coefficients"=c("Intercept","Democrat","Majority Party",
                                                "President of Same Party","Leadership",
                                                "Chair of Committee or Subcommittee",
                                                "Distance from Median (DW-Nominate)",
                                                "State Legislature Professionalism",
                                                "Vote Prop., Last Election",
                                                "Freshman",
                                                "Seniority","Female","Black","Latino",
                                                "Majority Latinx","Majority Black",
                                                "Pct. More Than HS","Median Income",
                                                "log(Population Density)"),
                               "VarNames" = rownames(summary(lm.pr)$coefficients),
                               round(summary(lm.tweets)$coefficients,digits=6)),
                    data.frame("Model"="(4) Facebook",
                               "Coefficients"=c("Intercept","Democrat","Majority Party",
                                                "President of Same Party","Leadership",
                                                "Chair of Committee or Subcommittee",
                                                "Distance from Median (DW-Nominate)",
                                                "State Legislature Professionalism",
                                                "Vote Prop., Last Election",
                                                "Freshman",
                                                "Seniority","Female","Black","Latino",
                                                "Majority Latinx","Majority Black",
                                                "Pct. More Than HS","Median Income",
                                                "log(Population Density)"),
                               "VarNames" = rownames(summary(lm.pr)$coefficients),
                               round(summary(lm.fb)$coefficients,digits=6)))

model.coefs$Lower = model.coefs$Estimate - 1.96*model.coefs$Std..Error
model.coefs$Upper = model.coefs$Estimate + 1.96*model.coefs$Std..Error

model.coefs$Type = ifelse(model.coefs$VarNames%in%c("latino_cat","black_cat","pct_mtHS",
                                                    "income_median_tens","log(density_pop)"),
                          "(c) District Characteristics",
                          ifelse(model.coefs$VarNames%in%c("dem","majority","pres_inparty",
                                                           "meddist","leadership",
                                                           "any_chair","deleg_size"),
                                 "(a) Institutional Status",
                                 ifelse(model.coefs$VarNames%in%"(Intercept)",NA,
                                        "(b) Legislator Characteristics")))

model.coefs$Coefficients2 = c("s. Intercept","r. Democrat","q. Majority Party",
                              "p. President of Same Party","o. Leadership",
                              "n. Chair of Committee or Subcommittee",
                              "m. Distance from Median (DW-Nominate)",
                              "l. State Legislature Professionalism",
                              "k. Vote Prop., Last Election",
                              "j. Freshman","i. Seniority",
                              "h. Female","g. Black","f. Latino",
                              "e. Majority Latinx","d. Majority Black",
                              "c. Pct. More Than HS","b. Median Income",
                              "a. log(Population Density)",
                              "s. Intercept","r. Democrat","q. Majority Party",
                              "p. President of Same Party","o. Leadership",
                              "n. Chair of Committee or Subcommittee",
                              "m. Distance from Median (DW-Nominate)",
                              "l. State Legislature Professionalism",
                              "k. Vote Prop., Last Election",
                              "j. Freshman","i. Seniority",
                              "h. Female","g. Black","f. Latino",
                              "e. Majority Latinx","d. Majority Black",
                              "c. Pct. More Than HS","b. Median Income",
                              "a. log(Population Density)",
                              "s. Intercept","r. Democrat","q. Majority Party",
                              "p. President of Same Party","o. Leadership",
                              "n. Chair of Committee or Subcommittee",
                              "m. Distance from Median (DW-Nominate)",
                              "l. State Legislature Professionalism",
                              "k. Vote Prop., Last Election",
                              "j. Freshman","i. Seniority",
                              "h. Female","g. Black","f. Latino",
                              "e. Majority Latinx","d. Majority Black",
                              "c. Pct. More Than HS","b. Median Income",
                              "a. log(Population Density)",
                              "s. Intercept","r. Democrat","q. Majority Party",
                              "p. President of Same Party","o. Leadership",
                              "n. Chair of Committee or Subcommittee",
                              "m. Distance from Median (DW-Nominate)",
                              "l. State Legislature Professionalism",
                              "k. Vote Prop., Last Election",
                              "j. Freshman","i. Seniority",
                              "h. Female","g. Black","f. Latino",
                              "e. Majority Latinx","d. Majority Black",
                              "c. Pct. More Than HS","b. Median Income",
                              "a. log(Population Density)")

# The Figure 
#Plots -- 13.93 in by 7.70 in
pdf("Figure1.pdf",13.93,7.70)
ggplot(model.coefs[!is.na(model.coefs$Type),]) +
  geom_segment(aes(y=Coefficients2, 
                   yend=Coefficients2, 
                   x=Lower, xend=Upper), color="grey") +
  geom_point(aes(y=Coefficients2, 
                 x=Estimate)) +
  geom_vline(xintercept = 0,linetype="dashed") +
  ylab(NULL) + xlab(NULL) + 
  theme_bw(base_size = 13) +
  theme(panel.grid.major = element_blank(), 
        panel.grid.minor = element_blank())+
  facet_grid(rows=vars(Type),cols=vars(Model),
             scales="free_y",space='free') +
  scale_y_discrete(breaks=model.coefs$Coefficients2[19:2],
                   labels=model.coefs$Coefficients[19:2])
dev.off()
################## 4. Appendix -- Summary ##################

#
# Count Histograms
#

pr.yr.hist = ggplot(house.wdist,aes(pr.yr)) + geom_histogram() + theme_bw() +
  xlab("Press Releases") + ylab("Frequency")
enews.yr.hist = ggplot(house.wdist,aes(enews.yr)) + geom_histogram() + theme_bw() +
  xlab("E-Newsletters") + ylab("Frequency")
tweets.yr.hist = ggplot(house.wdist,aes(tweets.yr)) + geom_histogram() + theme_bw() +
  xlab("Tweets") + ylab("Frequency")
fb.yr.hist = ggplot(house.wdist,aes(fb.yr)) + geom_histogram() + theme_bw() +
  xlab("Facebook") + ylab("Frequency")

plot_grid(pr.yr.hist,enews.yr.hist,
          tweets.yr.hist,fb.yr.hist)

#
# Scaled Histograms
#

pr.scaled.hist = ggplot(house.wdist,aes(pr.scaled)) + geom_histogram() + theme_bw() +
  xlab("Press Releases") + ylab("Frequency")
enews.scaled.hist = ggplot(house.wdist,aes(enews.scaled)) + geom_histogram() + theme_bw() +
  xlab("E-Newsletters") + ylab("Frequency")
tweets.scaled.hist = ggplot(house.wdist,aes(tweets.scaled)) + geom_histogram() + theme_bw() +
  xlab("Tweets") + ylab("Frequency")
fb.scaled.hist = ggplot(house.wdist,aes(fb.scaled)) + geom_histogram() + theme_bw() +
  xlab("Facebook") + ylab("Frequency")

plot_grid(pr.scaled.hist,enews.scaled.hist,
          tweets.scaled.hist,fb.scaled.hist)

#
# Summary Table
#

iv.table = summary.function(variables=house.wdist[,c("majority","pres_inparty","leadership",
                                                     "any_chair","meddist","deleg_size", 
                                                     "state_leg_prof","voteprop", 
                                                     "seniority","female","afam","latino", 
                                                     "pct_latinx","pct_black","pct_mtHS",
                                                     "income_median_tens","density_pop")],
                            names = c("Majority Party",
                                      "President of Same Party","Leadership",
                                      "Chair of Committee or Subcommittee",
                                      "Distance from Median (DW-Nominate)",
                                      "House Delegation Size",
                                      "State Legislature Prefessionalism",
                                      "Vote Prop., Last Election",
                                      "Seniority","Female","Black","Latino",
                                      "Pct. Latino","Pct. Black",
                                      "Pct. More Than HS","Median Income",
                                      "Population Density"))

xtable::xtable(round(iv.table,digits=2))

################## 5. Appendix -- Reg. Table ##################

texreg::texreg(list(lm.pr,lm.enews,lm.tweets,lm.fb),
               stars=c(0.05),
               custom.model.names = c("PR","E-News","Twitter","FB"),
               custom.coef.names = c("Intercept","Democrat","Majority Party",
                                     "President of Same Party","Leadership",
                                     "Chair of Committee or Subcommittee",
                                     "Distance from Median (DW-Nominate)",
                                     "State Legislature Professionalism",
                                     "Vote Prop., Last Election",
                                     "Freshman",
                                     "Seniority","Female","Black","Latino",
                                     "Majority Latinx","Majority Black",
                                     "Pct. More Than HS","Median Income",
                                     "log(Population Density)"))

################## 6. Appendix -- Raw Counts ##################

raw.tweets = lm(tweets.yr ~ dem+majority+pres_inparty+leadership+
                  any_chair+meddist + 
                  state_leg_prof+voteprop+ 
                  freshman +seniority+
                  female + afam + latino+ 
                  latino_cat+black_cat+
                  pct_mtHS+income_median_tens+
                  log(density_pop),
                data = house.wdist)
raw.fb = lm(fb.yr ~ dem+majority+pres_inparty+leadership+
              any_chair+meddist + 
              state_leg_prof+voteprop+ 
              freshman +seniority+
              female + afam + latino+ 
              latino_cat+black_cat+
              pct_mtHS+income_median_tens+
              log(density_pop),
            data = house.wdist)
raw.enews = lm(enews.yr ~ dem+majority+pres_inparty+leadership+
                 any_chair+meddist + 
                 state_leg_prof+voteprop+ 
                 freshman +seniority+
                 female + afam + latino+ 
                 latino_cat+black_cat+
                 pct_mtHS+income_median_tens+
                 log(density_pop),
               data = house.wdist)
raw.pr = lm(pr.yr ~ dem+majority+pres_inparty+leadership+
              any_chair+meddist + 
              state_leg_prof+voteprop+ 
              freshman +seniority+
              female + afam + latino+ 
              latino_cat+black_cat+
              pct_mtHS+income_median_tens+
              log(density_pop),
            data = house.wdist)

texreg::texreg(list(raw.pr,raw.enews,raw.tweets,raw.fb),
               stars=c(0.05),
               custom.model.names = c("Press Releases","E-News","Twitter","FB"),
               custom.coef.names = c("Intercept","Democrat","Majority Party",
                                     "President of Same Party","Leadership",
                                     "Chair of Committee or Subcommittee",
                                     "Distance from Median (DW-Nominate)",
                                     "State Legislature Professionalism",
                                     "Vote Prop., Last Election",
                                     "Freshman",
                                     "Seniority","Female","Black","Latino",
                                     "Majority Latinx","Majority Black",
                                     "Pct. More Than HS","Median Income",
                                     "log(Population Density)"))

################## 7. Appendix -- Neg. Binomial ##################

nb.tweets = glm.nb(tweets.yr ~ dem+majority+pres_inparty+leadership+
                     any_chair+meddist + 
                     state_leg_prof+voteprop+ 
                     freshman +seniority+
                     female + afam + latino+ 
                     latino_cat+black_cat+
                     pct_mtHS+income_median_tens+
                     log(density_pop),
                   data = house.wdist)
nb.fb = glm.nb(fb.yr ~ dem+majority+pres_inparty+leadership+
                 any_chair+meddist + 
                 state_leg_prof+voteprop+ 
                 freshman +seniority+
                 female + afam + latino+ 
                 latino_cat+black_cat+
                 pct_mtHS+income_median_tens+
                 log(density_pop),
               data = house.wdist)
nb.enews = glm.nb(enews.yr ~ dem+majority+pres_inparty+leadership+
                    any_chair+meddist + 
                    state_leg_prof+voteprop+ 
                    freshman +seniority+
                    female + afam + latino+ 
                    latino_cat+black_cat+
                    pct_mtHS+income_median_tens+
                    log(density_pop),
                  data = house.wdist)
nb.pr = glm.nb(pr.yr ~ dem+majority+pres_inparty+leadership+
                 any_chair+meddist + 
                 state_leg_prof+voteprop+ 
                 freshman +seniority+
                 female + afam + latino+ 
                 latino_cat+black_cat+
                 pct_mtHS+income_median_tens+
                 log(density_pop),
               data = house.wdist)

texreg::texreg(list(nb.pr,nb.enews,nb.tweets,nb.fb),
               stars=c(0.05),
               custom.model.names = c("Press Releases","E-News","Twitter","FB"),
               custom.coef.names = c("Intercept","Democrat","Majority Party",
                                     "President of Same Party","Leadership",
                                     "Chair of Committee or Subcommittee",
                                     "Distance from Median (DW-Nominate)",
                                     "State Legislature Professionalism",
                                     "Vote Prop., Last Election",
                                     "Freshman",
                                     "Seniority","Female","Black","Latino",
                                     "Majority Latinx","Majority Black",
                                     "Pct. More Than HS","Median Income",
                                     "log(Population Density)"))

################## 8. Appendix -- Poisson ##################


pois.tweets = glm(tweets.yr ~dem+majority+pres_inparty+leadership+
                    any_chair+meddist + 
                    state_leg_prof+voteprop+ 
                    freshman +seniority+
                    female + afam + latino+ 
                    latino_cat+black_cat+
                    pct_mtHS+income_median_tens+
                    log(density_pop),
                  data = house.wdist,
                  family="poisson")
pois.fb = glm(fb.yr ~ dem+majority+pres_inparty+leadership+
                any_chair+meddist + 
                state_leg_prof+voteprop+ 
                freshman +seniority+
                female + afam + latino+ 
                latino_cat+black_cat+
                pct_mtHS+income_median_tens+
                log(density_pop),
              data = house.wdist,
              family="poisson")
pois.enews = glm(enews.yr ~ dem+majority+pres_inparty+leadership+
                   any_chair+meddist + 
                   state_leg_prof+voteprop+ 
                   freshman +seniority+
                   female + afam + latino+ 
                   latino_cat+black_cat+
                   pct_mtHS+income_median_tens+
                   log(density_pop),
                 data = house.wdist,
                 family="poisson")
pois.pr = glm(pr.yr ~ dem+majority+pres_inparty+leadership+
                any_chair+meddist + 
                state_leg_prof+voteprop+ 
                freshman +seniority+
                female + afam + latino+ 
                latino_cat+black_cat+
                pct_mtHS+income_median_tens+
                log(density_pop),
              data = house.wdist,
              family="poisson")

texreg::texreg(list(pois.pr,pois.enews,pois.tweets,pois.fb),
               stars=c(0.05),
               custom.model.names = c("Press Releases","E-News","Twitter","FB"),
               custom.coef.names = c("Intercept","Democrat","Majority Party",
                                     "President of Same Party","Leadership",
                                     "Chair of Committee or Subcommittee",
                                     "Distance from Median (DW-Nominate)",
                                     "State Legislature Professionalism",
                                     "Vote Prop., Last Election",
                                     "Freshman",
                                     "Seniority","Female","Black","Latino",
                                     "Majority Latinx","Majority Black",
                                     "Pct. More Than HS","Median Income",
                                     "log(Population Density)"))

################## 9. Appendix -- OLS, Proportion of the District ##################

lm.tweets1 = lm(tweets.scaled ~ majority+pres_inparty+leadership+
                  any_chair+meddist+deleg_size + 
                  state_leg_prof+voteprop + 
                  seniority +female + afam + latino+ 
                  pct_latinx+pct_black+
                  pct_mtHS+pct_inpoverty+
                  log(density_pop),
                data = house.wdist)
lm.fb1 = lm(fb.scaled ~ majority+pres_inparty+leadership+
              any_chair+meddist +deleg_size + 
              state_leg_prof+voteprop + 
              seniority +female + afam + latino+ 
              pct_latinx+pct_black+
              pct_mtHS+pct_inpoverty+
              log(density_pop),
            data = house.wdist)
lm.enews1 = lm(enews.scaled ~ majority+pres_inparty+leadership+
                 any_chair+meddist +deleg_size + 
                 state_leg_prof+voteprop + 
                 seniority +female + afam + latino+ 
                 pct_latinx+pct_black+
                 pct_mtHS+pct_inpoverty+
                 log(density_pop),
               data = house.wdist)
lm.pr1 = lm(pr.scaled ~ majority+pres_inparty+leadership+
              any_chair+meddist +deleg_size + 
              state_leg_prof+voteprop + 
              seniority +female + afam + latino+ 
              pct_latinx+pct_black+
              pct_mtHS+pct_inpoverty+
              log(density_pop),
            data = house.wdist)

texreg::texreg(list(lm.pr1,lm.enews1,lm.tweets1,lm.fb1),
               stars=c(0.05),
               custom.model.names = c("PR","E-News","Twitter","FB"),
               custom.coef.names = c("Intercept","Majority Party",
                                     "President of Same Party","Leadership",
                                     "Chair of Committee or Subcommittee",
                                     "Distance from Median (DW-Nominate)",
                                     "House Delegation Size",
                                     "State Legislature Prefessionalism",
                                     "Vote Prop., Last Election",
                                     "Seniority","Female","Black","Latino",
                                     "Pct. Latino","Pct. Black",
                                     "Pct. More Than HS","Pct. In Poverty",
                                     "log(Population Density)"))
